const Layout = () => import('@/layout/index.vue')
const Login = () => import('@/views/Login/index.vue')
const Home = () => import('@/views/Home/index.vue')
const NotFound = () => import('@/views/NotFound/index.vue')
const Screen = () => import('@/views/Screen/index.vue')
const User = () => import('@/views/Acl/User/index.vue')
const Role = () => import('@/views/Acl/Role/index.vue')
const Permission = () => import('@/views/Acl/Permission/index.vue')
const Trademark = () => import('@/views/Product/Trademark/index.vue')
const Attr = () => import('@/views/Product/Attr/index.vue')
const Spu = () => import('@/views/Product/Spu/index.vue')
const Sku = () => import('@/views/Product/Sku/index.vue')

const routes = [
	// layout
	{
		name: 'layout',
		path: '/',
		redirect: '/home',
		component: Layout,
		meta: {
			// 是否显示在菜单栏
			isShowInMenu: true,
		},
		children: [
			{
				name: 'home',
				path: 'home',
				component: Home,
				meta: {
					title: '首页',
					isShowInMenu: true,
					// 菜单图标
					icon: 'HomeFilled',
				},
			},
		],
	},
	// 登录
	{
		name: 'login',
		path: '/login',
		component: Login,
		meta: {
			title: '登录',
			isShowInMenu: false,
		},
	},
	// 404
	{
		path: '/404',
		component: NotFound,
		meta: {
			title: '404',
			isShowInMenu: false,
		},
	},
	// 匹配所有内容，但是没有被其他路由匹配到的内容
	// 将匹配所有内容并将其放在 `route.params.pathMatch` 下
	{
		path: '/:pathMatch(.*)*',
		redirect: '/404',
		meta: {
			title: '任意路由',
			isShowInMenu: false,
		},
	},
	// 数据大屏
	{
		name: 'Screen',
		path: '/screen',
		component: Screen,
		meta: {
			title: '数据大屏',
			isShowInMenu: true,
			icon: 'DataBoard',
		},
	},
	// 权限管理
	{
		name: 'Acl',
		path: '/acl',
		component: Layout,
		redirect: '/acl/user',
		meta: {
			title: '权限管理',
			isShowInMenu: true,
			icon: 'Lock',
		},
		children: [
			{
				name: 'User',
				path: 'user',
				component: User,
				meta: {
					title: '用户管理',
					isShowInMenu: true,
					icon: 'User',
				},
			},
			{
				name: 'Role',
				path: 'role',
				component: Role,
				meta: {
					title: '角色管理',
					isShowInMenu: true,
					icon: 'UserFilled',
				},
			},
			{
				name: 'Permission',
				path: 'permission',
				component: Permission,
				meta: {
					title: '菜单管理',
					isShowInMenu: true,
					icon: 'ChromeFilled',
				},
			},
		],
	},
	// 商品管理
	{
		name: 'Product',
		path: '/product',
		component: Layout,
		redirect: '/product/trademark',
		meta: {
			title: '商品管理',
			isShowInMenu: true,
			icon: 'Goods',
		},
		children: [
			{
				name: 'Trademark',
				path: 'trademark',
				component: Trademark,
				meta: {
					title: '品牌管理',
					isShowInMenu: true,
					icon: 'ShoppingCart',
				},
			},
			{
				name: 'Attr',
				path: 'attr',
				component: Attr,
				meta: {
					title: '属性管理',
					isShowInMenu: true,
					icon: 'Refrigerator',
				},
			},
			{
				name: 'Spu',
				path: 'spu',
				component: Spu,
				meta: {
					title: 'Spu管理',
					isShowInMenu: true,
					icon: 'WindPower',
				},
			},
			{
				name: 'Sku',
				path: 'sku',
				component: Sku,
				meta: {
					title: 'Sku管理',
					isShowInMenu: true,
					icon: 'Basketball',
				},
			},
		],
	},
]

export default routes
